# -*- coding: utf-8 -*-

"""
Module implementing Dialog.
"""
from PyQt4 import QtCore, QtGui
from PyQt4.QtGui import QDialog
from PyQt4.QtCore import pyqtSignature

from Ui_pub_UI import Ui_Dialog
import  searchWord
import PyQt4, sys

class Dialog(QDialog, Ui_Dialog):
    """
    Class documentation goes here.
    """
    def __init__(self, parent = None):
        """
        Constructor
        """
        QDialog.__init__(self, parent)
        self.setupUi(self)
    
    @pyqtSignature("")
    def on_pushButton_clicked(self):
        s = unicode(self.textEdit.toPlainText().toUtf8(), 'gbk', 'ignore').encode('gbk')
        print s
        re = searchWord.searchWord(s)
        for i in range(10):
            for j in range(4):
                item = QtGui.QTableWidgetItem(QtGui.QApplication.translate("Dialog", re[i][j], None, QtGui.QApplication.UnicodeUTF8))
                self.tableWidget_2.setItem(i, j, item)
        
        #raise NotImplementedError
        
if __name__ == "__main__":
    app = PyQt4.QtGui.QApplication(sys.argv)
    dlg = Dialog()
    dlg.show()
    sys.exit(app.exec_()) 
    dlg=Dialog()

